import request from '@/utils/request'

export function listUser(data) {
  return request({
    // url: '/ht/api/HtUser/list',
    url: '/admin/HtUser/list',
    method: 'post',
    data
  })
}
// get 方式获取列表
export function getListUser(params) {
  return request({
    url: '/system/user/getList',
    method: 'post',
    params
  })
}

export function updateUser(data) {
  return request({
    // url: '/admin/HtUser/' + data.id,
    url: '/admin/HtUser/update',
    method: 'put',
    data
  })
}

export function addUser(data) {
  return request({
    url: '/admin/HtUser/create',
    method: 'post',
    data
  })
}

export function delUser(data) {
  return request({
    url: '/admin/HtUser/delete',
    method: 'post',
    data
  })
}

// 单个实体
export function oneUser(id) {
  return request({
    url: '/admin/HtUser/info',
    method: 'get',
    params:{
      id
    }
  })
}

/**
 * 获取实体用于编辑
 * @param id
 * @returns {AxiosPromise}
 */
export function oneUserForEdit(id) {
  return request({
    url: '/admin/HtUser/' + id,
    method: 'get'
  })
}

/**
 * 获取用户元信息
 * @param id
 * @returns {AxiosPromise}
 */
export function oneUserOrigin(id) {
  return request({
    url: '/ht/api/User/' + id + '/edit',
    method: 'get'
  })
}

export function updateUserOrigin(data) {
  return request({
    url: '/ht/api/User/' + data.id,
    method: 'put',
    data
  })
}

// 修改密码
export function passwordChange(data) {
  return request({
    url: '/au/PasswordChange',
    method: 'post',
    data
  })
}
